import { ApiException } from 'src/common/exceptions/api.exception';
import Fontlist from 'src/entities/admin/sys-font-list.entity';
import { InjectRepository } from '@nestjs/typeorm';
import { Injectable } from '@nestjs/common';
import { Repository } from 'typeorm';
import { CreateFontDto, FontlistDto } from './fontlist.dto';

@Injectable()
export class SysFontlistService {
  constructor(
    @InjectRepository(Fontlist)
    private readonly fontlistRepository: Repository<Fontlist>,
  ) {}
  /**
   * 获取字体列表
   */
  async findAll(queryParams): Promise<Fontlist[]> {
    const { page, limit } = queryParams;
    const qb = this.fontlistRepository
      .createQueryBuilder('fontlist')
      .skip((page - 1) * limit)
      .take(limit)
      .orderBy('fontlist.id', 'ASC');
    const data = await qb.getMany();
    return data;
  }
}
